<?php
 /*
  处理标记
  */ 
$db = new mysqli("10.19.5.9","liupanpan","123","qingbao_db");
if ($db->connect_errno) {
    printf("Connect failed: %s\n", $db->connect_error);
    exit();
}
mysqli_set_charset($db, "utf8");
  

 //修改
if(isset($_POST["id"])){
    $id = $_POST['id'];
    $num = $_POST['num'];

    $arr = json_decode($id,true);
    $length=sizeof($arr);
    if($length > 1 ){  
       for ($i=0; $i < $length ; $i++) { 
         $idone=$arr[$i];
         $update="update train_corpus_final set manual_annotation='{$num}'  where id=$idone";
         $resultu = $db->query($update);
         if($resultu != 0){
             echo  "0";
         }else{
             echo  "-1";
             //echo  "-1".mysqli_error();
         }
       }
    }elseif ($length == 1) {
       $update="update train_corpus_final set manual_annotation='{$num}'  where id=$id"; 
       $resultu= $db->query($update);
       if($resultu != 0){
           echo  "0";
       }else{
           echo  "-1";
       }
    }
}


?>